package com.lemobar.pay.model.alipay.response;

import com.lemobar.pay.model.alipay.TradeFundBill;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * 订单查询
 * alipay.trade.query(统一收单线下交易查询)
 * 付款码支付 https://opendocs.alipay.com/apis/02ekfq?scene=23 (alipay.trade.query)
 * APP支付 https://opendocs.alipay.com/apis/02e7gm (alipay.trade.query)
 * 手机网站支付WAP https://opendocs.alipay.com/apis/02ivbt (alipay.trade.query)
 */
@Data
public class AliPayTradeQueryResponse {

    /* 响应实例
    {
        "alipay_trade_query_response": {
            "code": "10000",
            "msg": "Success",
            "trade_no": "2013112011001004330000121536",
            "out_trade_no": "6823789339978248",
            "buyer_logon_id": "159****5620",
            "trade_status": "TRADE_CLOSED",
            "total_amount": 88.88,
            "buyer_pay_amount": 8.88,
            "point_amount": 10,
            "invoice_amount": 12.11,
            "send_pay_date": "2014-11-27 15:45:57",
            "receipt_amount": "15.25",
            "store_id": "NJ_S_001",
            "terminal_id": "NJ_T_001",
            "fund_bill_list": [
                {
                    "fund_channel": "ALIPAYACCOUNT",
                    "amount": 10,
                    "real_amount": 11.21
                }
            ],
            "store_name": "证大五道口店",
            "buyer_user_id": "2088101117955611",
            "buyer_user_type": "PRIVATE",
            "mdiscount_amount": "88.88",
            "discount_amount": "88.88",
            "ext_infos": "{\"action\":\"cancel\"}"
        },
        "sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
    }
     */

    private AliPayTradeQueryResponse.Content alipayTradeQueryResponse;

    private String sign;

    @Data
    public static class Content {

        private String code;

        private String msg;

        private String subCode;

        private String subMsg;

        /**
         * 支付宝交易号
         */
        private String tradeNo;

        /**
         * 商家订单号
         */
        private String outTradeNo;

        /**
         * 买家支付宝账号
         */
        private String buyerLogonId;

        /**
         * 交易状态：WAIT_BUYER_PAY（交易创建，等待买家付款）、TRADE_CLOSED（未付款交易超时关闭，或支付完成后全额退款）、TRADE_SUCCESS（交易支付成功）、TRADE_FINISHED（交易结束，不可退款）
         */
        private String tradeStatus;

        /**
         * 交易的订单金额，单位为元，两位小数。该参数的值为支付时传入的total_amount
         */
        private Double totalAmount;

        /**
         * 买家实付金额，单位为元，两位小数。该金额代表该笔交易买家实际支付的金额，不包含商户折扣等金额
         */
        private Double buyerPayAmount;
        /**
         * 积分支付的金额，单位为元，两位小数。该金额代表该笔交易中用户使用积分支付的金额，比如集分宝或者支付宝实时优惠等
         */
        private Double pointAmount;

        private Double invoiceAmount;
        private Date sendPayDate;
        private String receiptAmount;
        private String storeId;
        private String terminalId;
        private List<TradeFundBill> fundBillList;
        private String storeName;
        private String buyerUserId;
        private String buyerUserType;
        private String mdiscountAmount;


    }
}
